package entity;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Venue {
	private Date date;// representing Date
	private String type;
	private String venueID;
	private String[] bookingSlot;

	public Venue(String dataString) throws ParseException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
		String[] data = dataString.split(" ");

		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-mm-dd");
		this.setDate(formatter.parse(data[0]));
		this.setType(data[1]);
		this.setVenueID(data[2]);
		
		this.bookingSlot = new String[data.length-3];
		for (int i = 0; i < this.bookingSlot.length; i++){
			this.bookingSlot[i] = data[i+3];
		}
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getVenueID() {
		return venueID;
	}

	public void setVenueID(String venueID) {
		this.venueID = venueID;
	}

	public String getContentStr() {
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-mm-dd");
		String contentStr = formatter.format(this.date);

		contentStr += " " + this.type + " " + this.venueID;

		for (int i = 0; i < this.bookingSlot.length; i++) {
			contentStr += " " + this.bookingSlot[i];
		}

		return contentStr;
	}
	
	public String[] getBookingSlot() {
		return bookingSlot;
	}

	public void setBookingSlot(String[] bookingSlot) {
		this.bookingSlot = bookingSlot;
	}
}
